<case value="picture">
<div class="row">
    <div class="form-group controls item_{$field.name} {$field.extra_class}">
    <label for="{$field.name}" class="col-md-3 control-label">{$field.title|htmlspecialchars}</label>
    <div class="col-md-9" style="padding-bottom: 5px;"><span id="upload_single_image_{$field.name}" class="btn btn-info btn-raised btn-sm">上传</span><span class="btn btn-info btn-raised btn-sm" data-toggle="modal" data-target="#attachmentModal">选择图片</span>
      
        <input class="attach" type="hidden" name="{$field.name}" value="{$field['value']}"/>

        <div class="upload-img-box tc popup-gallery img-thumbnail">
            <div class="each">
            <empty name="field.value">
                <img src="<php>echo get_cover(0,'noimg');</php>">
            <else /> 
                <a href="{$field.value|get_cover='path'}" title="点击查看大图">
                    <img src="{$field.value|get_cover='path','noimg'}">
                </a>
                    <div class="text-center opacity del_btn" ></div>
                    <div onclick="admin_image.removeImage($(this),'{$field.value}')"  class="text-center del_btn">删除</div>  
            </empty>
            </div>
        </div>

        </div>
            <!--附件列表模态框-->
            <div class="modal fade" id="attachmentModal" tabindex="-1" role="dialog" aria-labelledby="attachmentModalLabel">
                  <div class="modal-dialog">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title tc">图片选择器</h4>
                      </div>
                      <div class="modal-body">
                        {:W('Common/Attachment/lists',array($field))}
                      </div>
                    </div><!-- /.modal-content -->
                  </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->
        </div>
        <script>
            $(function () {
                var uploader_{$field.name}= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('Attachment/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_{$field.name}',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_{$field.name}.on('fileQueued', function (file) {
                    uploader_{$field.name}.upload();
                });
                /*上传成功**/
                uploader_{$field.name}.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='{$field.name}']").val(data.id);
                        $("[name='{$field.name}']").parent().find('.popup-gallery').html(
                                ' <div class="each"><a href="'+ _ROOT_+data.path+'" title="点击查看大图片"><img src="'+ _ROOT_+data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_{$field.name}.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script>
    </div>
</case>
